import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:u9mobile/blocs/template_bloc.dart';
import 'package:u9mobile/widgets/bill_detail.dart';
import 'package:u9mobile/widgets/attach_list.dart';
import 'package:u9mobile/widgets/work_flow.dart';

class TodoDetailPage extends StatefulWidget {
  const TodoDetailPage({super.key});
  static const String route = '/home';
  @override
  State<TodoDetailPage> createState() => _TodoDetailState();
}

class _TodoDetailState extends State<TodoDetailPage> with SingleTickerProviderStateMixin {
  final snackBar = const SnackBar(
    content: Text('加载'),
    backgroundColor: Colors.blue,
  );
  late TabController _tabController;
  static final tabs=[
    const Tab(text: '详情',),
    const Tab(text: '流程',),
    const Tab(text: '附件',),
  ];
  @override
  void initState(){
    super.initState();
    _tabController = TabController(length: tabs.length, vsync: this);
  }
  List<String> sweets=List.generate(20, (index) {
    return '1 - $index';
  });
  

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(
          title: const Text('详情'),
          centerTitle: true,
          bottom: TabBar(
            controller: _tabController,
            tabs:tabs
          ),
        ),
        body: TabBarView(
          controller: _tabController,
          children: [
            BlocProvider(
              create: (context) => TemplateBloc(),
              child: const BillDetail()
            ),
            const WorkFlow(),
            const AttachList(),
          ],
        ),
    );
  }
}
